package com.easybuy.service.UserService;

import com.easybuy.Tools.Page;
import com.easybuy.dao.UserMapper;
import com.easybuy.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    public User selectByLoginName(String loginName) {
        return userMapper.selectByLoginName(loginName);
    }

    public int addUser(User user) {
        return userMapper.addUser(user);
    }

    @Override
    public User getUser(int id) {
        return userMapper.selectById(id);
    }

    public Page<User> userList(Page page) {
        page.setPageCount(userMapper.selectCount());
        page.setList(userMapper.userList(page));
        return page;
    }

    public int modifyUser(User user) {
        return userMapper.modifyUser(user);
    }

    public int deleUser(int id) {
        return userMapper.deleUser(id);
    }
}
